<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style>
			#box{
				width: 300px;
				height: 200px;
				border: 1px solid #000000;
			}
		</style>
	</head>
	<body>
		<ul id="box">
			
		</ul>
		<script src="ajax.js"></script>
		<script>
			
			 async function getData(page){
			
			        var page = page || 6
			        var doc = await AJAX('GET','http://39.105.192.164:9090/apitest/goodslist','pager='+page)
			        
			        
			        var dataAll = JSON.parse(doc)
			       
			       
					renderData(dataAll)
			    }
			
			var Box = document.getElementById('box');
			function renderData(dataAll){
			
			    var str ="";
			    for(var i=0;i<dataAll.data.list.length;i++){
			        
			       
			        str +=`
			            <li> <a id="${dataAll.data.list[i].id}" href="http://localhost/jiuxianwang/html/goods.html?id=${dataAll.data.list[i].id}"><img src=${dataAll.data.list[i].pic}></a>
			                <h5>${dataAll.data.list[i].name}</h5>
			                <p>价格:￥${dataAll.data.list[i].price}</p>
			            </li>    
			        `;
			        
			       
			        Box.innerHTML = str
			      
			    } 
		}
		</script>
	</body>
</html>
